 
#import "../Stone3DAPI/Stone3D.h"

#import "PatchMeshInspector.h"
#import "PatchMesh.h"

@implementation PatchMeshInspector

- loadShape:(Shape *)shape inView:(Camera *)camera
{
    [super loadShape:shape inView:camera];
    if (shape) {
	if ([shape isKindOf:[PatchMesh class]]) {
	    [pointsVisibleSwitch setState:
				    [(PatchMesh *)shape controlVisible]];
	    [hullVisibleSwitch setState:
				    [(PatchMesh *)shape hullVisible]];
	    setTitle(uBasisButton,[(PatchMesh *)shape uBasis]);
	    setTitle(vBasisButton,[(PatchMesh *)shape vBasis]);
	}
    }
    return self;
}

- changePointsVisible:sender
{   
    Shape *shape = [self selectedShape];
    if (shape && [shape isKindOf:[PatchMesh class]]) {
	[(PatchMesh *)shape setControlVisible:[sender state]];
	[self displayChanges];
    }

    return self;
}

- changeHullVisible:sender
{
    Shape *shape = [self selectedShape];
    if (shape && [shape isKindOf:[PatchMesh class]]) {
	[(PatchMesh *)shape setHullVisible:[sender state]];
	[self displayChanges];
    }

    return self;
}
   

- setUBasis:sender
{
    Shape *shape = [self selectedShape];
    if (shape && [shape isKindOf:[PatchMesh class]]) {
	[(PatchMesh *)shape setUBasis:[sender selectedTag]];
	[self displayChanges];
    }
    return self;
}

- setVBasis:sender
{
    Shape *shape = [self selectedShape];
    if (shape && [shape isKindOf:[PatchMesh class]]) {
	[(PatchMesh *)shape setVBasis:[sender selectedTag]];
	[self displayChanges];
    }
    return self;
}

@end